﻿using System;

namespace ARS.Control.Attributes
{
    public class ListAndItem
    {

        /// <summary>
        /// 
        /// </summary>
        /// <param name="listItem"></param>
        /// <param name="listValue"></param>
        /// <returns></returns>
        public static string[] GetValueListItem(string[] listItem, string listValue)
        {
            return GetValueListItem(listItem, ref listValue);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="listItem"></param>
        /// <param name="listValue"></param>
        /// <returns></returns>
        public static string[] GetValueListItem(string[] listItem, ref string listValue)
        {
            if (listItem == null)
            {
                if (listValue != null)
                {
                    listItem = listValue.Split(new[] { Const.OPERATLISTDELIMITER }, StringSplitOptions.None);
                }
            }
            return listItem;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="listItem"></param>
        /// <param name="listValue"></param>
        /// <returns></returns>
        public static string GetValueList(string[] listItem, ref string listValue)
        {
            if (listValue == null)
            {
                if (listItem != null)
                {
                    listValue = string.Join(Const.OPERATLISTDELIMITER, listItem);
                }
            }
            return listValue;
        }
    }
}
